package com.hs.room.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.hs.room.model.sys.SysUser
import kotlinx.coroutines.flow.Flow

@Dao
interface UserDao {

    @Insert
    suspend fun insertUser(user: SysUser)

    @Update
    suspend fun updateUser(user: SysUser) : Int


    @Query("SELECT * FROM SYS_USER where :sysTemNo = sysTemNo")
    suspend fun selectBySysTemNo(sysTemNo:String) : SysUser

    @Query("SELECT * FROM SYS_USER where :featureId = featureId")
    fun selectByFingerId(featureId: Int) :SysUser

    @Query("SELECT * FROM sys_user")
     fun getAllUsers(): Flow<List<SysUser>>

    @Query("SELECT * FROM sys_user where :account = account")
    fun selectByAccount(account: String) : SysUser

    /**
     * 获取最大的指纹id
     */
    @Query("SELECT MAX(featureId) FROM sys_user")
    fun getMaxFeatureId(): Int


}